<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title></title>
<link rel="stylesheet" href="__ADMIN__/css/pintuer.css">
<link rel="stylesheet" href="__ADMIN__/css/admin.css">
<script src="__ADMIN__/js/jquery.js"></script>
<script src="__ADMIN__/js/pintuer.js"></script>
</head>
<body>
<div class="panel admin-panel">
  <div class="panel-head" id="add"><strong><span class="icon-pencil-square-o"></span>节点列表</strong></div>
  <div class="body-content">
    <form method="post" class="form-x" action="{:url('admin/role/bindnode')}">

      <input type="hidden" name="role_id" value="{$roleId}" />

      {foreach name="node" item="nodeInfo"}
        <div class="form-group">
          <div class="label" style="width:120px;">
            <label><input type="checkbox" onclick="selectmore(this)">全选/全不选：</label>
          </div>
          <div class="field" style="padding-top:8px;">
            {volist name="nodeInfo" id="ni"}
              <span style="display:inline-block;width:15%;">
                <input type="checkbox" name="node_id[]" value="{$ni.id}"
                 {notempty name="ni.pivot"}
                   checked="checked"
                 {/notempty}
                />{$ni.name}
              </span>
            {/volist}
          </div>
        </div>
      {/foreach}

      <div class="clear"></div>

      <div class="form-group">
        <div class="label">
          <label></label>
        </div>
        <div class="field">
          <button class="button bg-main icon-check-square-o" type="submit"> 提交</button>
        </div>
      </div>
    </form>
  </div>
</div>

</body>
<script type="text/javascript">
    function selectmore(ob){
        if(ob.checked){
            $(ob).parents('.label').next('.field').find('input').prop("checked",true);
            console.log(ob)
            console.log( $(ob).parents('.label').next('.field').find('input'))
        }else{
            $(ob).parents('.label').next('.field').find('input').attr("checked",false);
        }
    }
</script>
</html>